#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int mod = 998244353;
const int N = 5010;

ll ans,S[N][N];

ll qp(ll x,int t){x %= mod;ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

ll inv(ll x){return qp(x,mod-2);}

ll calc(int n,int m){
	ll res = 0,_n = n+1;
	for(int j = 0;j <= m;j++){
		res = (res + S[m][j] * inv(j+1) % mod * _n % mod) % mod;
		_n = _n * (n + 1 - j - 1) % mod;
	}return res;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	ll n;int m; scanf("%lld %d",&n,&m); n %= mod;
	S[0][0] = 1;
	for(int i = 1;i < N;i++)
		for(int j = 0;j <= i;j++)
			S[i][j] = ((j > 0 ? S[i-1][j-1] : 0) + S[i-1][j] * j) % mod;
	ll ans = n - (calc(n-1,m+1) * inv(calc(n-1,m)) % mod) + mod; ans %= mod;
	printf("%lld\n",ans);
	return 0;
}

